<script setup>
const emits = defineEmits(['change' /*, 'update:activeName'*/])

const props = defineProps({
  tabList: Array,
//   activeName: String,
})

const activeName = defineModel('activeName')

const onChangeTab = (name) => {
    emits('change', name)
    activeName.value = name
//   emits('update:activeName', name)
}

</script>
<template>
    <div class="dots-tabs">
        <div class="before dots">
            <i></i>
            <i></i>
            <i></i>
            <i></i>
        </div>
        <div class="tabs">
            <div class="tab-item" :class="{ on: item.name == activeName }" v-for="item in tabList" :key="item.name" @click="onChangeTab(item.name)">{{ item.name }}</div>
        </div>
        <div class="after dots">
            <i></i>
            <i></i>
            <i></i>
            <i></i>
        </div>
    </div>
</template>

<style scoped lang="scss">
.dots-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbdbf6;
    height: 32px;
    line-height: 32px;
    margin-bottom: 10px;

    .dots {
      display: flex;
      align-items: center;
      gap: 5px;
      i {
        display: inline-block;
        width: 3px;
        height: 3px;
        border-radius: 3px;
        background: #bbdbf6;
      }
    }

    .tabs {
      display: flex;
    }

    .tab-item {
      position: relative;
      cursor: pointer;
      padding: 0 6px;
      margin: 0 6px;
      font-size: 13px;
    }
    .tab-item::before {
      content: '';
      position: absolute;
      width: 2px;
      height: 0.7em;
      right: -7px;
      top: 12px;
      background-color: #ffffff;
    }
    .tab-item:last-child::before {
      display: none;
    }
    .tab-item.on {
      color: #f8ea9a;
    }
    .tab-item.on::after {
      content: '';
      display: block;
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background: linear-gradient(90deg,rgba(248, 234, 154, 0.01), rgba(248, 234, 154, 0.4), rgba(248, 234, 154, 0.01));
    }
  }
</style>